Webhook for Status Updates

I am trying to post Status Updates into Slack.

I would like to see a Service Extension that will run a POST request whenever there is a Status Update. I want the address to which the POST request goes to be configurable.

I am interested in having PD engineers create this feature, but I would also create it if I was given guidance.

Stephen

2 Likes

Hi Stephen,

I’m afraid we do not currently have this ability at this time, but I can relay this Feedback to our Product Team. The PagerDuty webhook format can be found here and the expected payload from Slack to post messages can be found here.

Hannah

Hi Hannah thank you for the reply! I guess there are two possible ways to solve my problem.

  1. Can PagerDuty add an “Event Type” to the V3 webhook for when Status Updates are posted to an incident? It would be called something like incident.status_update. (Can you place a feature request for this?)

  2. Can you show me how to write a custom extension, which would be able to be triggered on a Status Update?

Hello Stephen,

The feature request has been logged with the Product Team.

As to the request to show you how to write a custom extension, please can you reach out to your Account Manager. They should be able to put you in touch with the Professional Services Team who could be able to assist in that regard.

Kind regards

1 Like

Hi Stephen,

This is a totally unofficial non-PD-supported answer, but for my own needs I have solved this in the past by polling the /log_entries endpoint and reconstituting webhooks from the log entries I’m interested in. I know polling sounds old-fashioned but it’s actually easier and more efficient than webhooks in many cases. You can see an example project I made using this approach implemented in Python with Celery at https://github.com/martindstone/PDaltagent - I just maintain a rudimentary list of recently seen log entries in SQLite so that I don’t process the same log entry twice… have a look at tasks.py for the polling code. You can also see an even more rudimentary JavaScript implementation that I did at https://martindstone.github.io/PDlive/

Hope this helps!

3 Likes

Hi @martin, thanks for sharing that resource, much appreciated. Most recently, we’ve been looking to leverage your work on the PD-CLI within our organisation as well: super handy!

I had a related query regarding webhook integration that I was hoping you could shed some light on. In short, whenever any alert is opened/closed on certain services, we want to send an associated JSON payload to a REST API endpoint. Here, it’s fed into a real-time visualisation dashboard, customised for internal use.

The recently released automated triggers which allows us to define dynamic custom action webhooks was a near perfect match for our needs. But it fell short because:

  • We need to pass specific Header values to the API endpoint (currently, not supported).
  • We need to pass the alert’s payload in a particular standardised JSON format (not sure if this is supported).

Do you happen to know of some way we can approach this? Can this be addressed by Webhook v2 or v3?

Thanks for your time.

1 Like

Hi Rishav,

I’m so glad to hear that you’re getting some value from the CLI!! I’m actively working on it and adding new functionality pretty fast; be sure and let me know if you see ways for it to be more useful.

Regarding adding headers to and transforming the payload of PagerDuty webhooks, I know that this is something that some of us are thinking about a lot, but you’re right in saying that it’s not currently supported in our product… I don’t personally have any insight into whether or when we would add it.

For my own needs, I have solved for this in one of two ways:

(1) PDaltagent can be modified pretty easily to send arbitrary JSON payloads with arbitrary headers. Starting points for doing that would be the ile_to_webhook function in pd.py, and the send_webhook function in tasks.py

(2) Sometimes for simpler needs I will use a Lambda. Especially if you don’t need any persistent state, it’s pretty easy to make a Lambda that listens for PD generic webhooks, transforms them and sends them on their way. Sometimes I will include some rudimentary shared secret in the URL so that nobody stumbles on it “by accident.”

Hope this helps, and thanks for using our stuff!

2 Likes

Thank you! I am excited for this possibility!

Thanks for the answer!

I spent some time looking through your code, and it looks good!

I have a question,

how does your strategy compare with one where you poll for status updates rather than log entries? ( Like this r = session.get(f"/incidents/{incident_id}/status_updates"))

Hi Stephen,

You can definitely do that, but status_updates only refers to “status update” messages that incident responders send out to incident subscribers (it’s not a list of status changes to the incident, as the endpoint name might seem to imply, lol). Polling log_entries is nice because it captures absolutely everything that happens to incidents, and also because you don’t need to know incident ID’s beforehand…

Hope this helps!

Edit: Aaaaand I see now that status update messages are what you are interested in, lol! So that approach would work fine for you! But you will probably first have to list incidents to get a list of incident ID’s to look for status updates on…

This helps alot, thank you!

@stephen.french: We have actually just released an incident.status_update_published event for V3 Webhooks. You should be able to find out more about it here v3 Webhooks Overview and you should also see it in the v3 Webhooks UI.

1 Like

Thanks @charlie.crawford, would be super helpful if incidnt.status_update_published flowed to the AWS Event Bridge Extension: https://support.pagerduty.com/docs/amazon-eventbridge-integration-guide
This would completely solve everyone’s challenge I believe. Any guidance on whether that’s supported or in the works?

All best!